<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="org.apache.catalina.tribes.util.TcclThreadFactory"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date" %>
<%@page import="java.sql.*" %>
<%@page import="org.edu.system.DBConnect" %>
<!DOCTYPE html>
<html>
<head>
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
	String tc_id = (String) (session.getAttribute("UserName"));
	Connection con = DBConnect.getCon();
	Statement stmt = null;
	ResultSet rs = null;
	stmt = con.createStatement();
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
#Container {
	width: 100%;
	height: 100%;
	margin: 0px auto;
}

#function {
	float: left;
	width: 120px;
	height: 620px:
}

#deal {
	float: left;
	width: 83%;
	height:650px;
}

#info {
	width: 100%;
	height: 30px;
	clear:both
	
}
</style>
</head>
<body>
	<br>
	<form method="get" name="frmLogin" >
		<div id="Container">
			<div id="edit">
				<div id="function">
				</div>
				<div id="deal">
					<%
					PreparedStatement pst = null;
					ResultSet rs1 = null;
					try{
						String sql_select = "SELECT lesson_id,course_name,time,week,class,location FROM lesson l,course c where tc_id='"+tc_id+"' and l.course_id = c.course_id";
						Connection con1 = DBConnect.getCon();
						request.setCharacterEncoding("utf-8");
						System.out.println(sql_select);
						pst = con1.prepareStatement(sql_select);
						rs1 = pst.executeQuery();
						System.out.println(pst);
						System.out.println(rs1);
					%>
					<table border=“1” class="table table-striped table-bordered">
						<tr>
							<th><font size="2">授课ID</font></th>
							<th><font size="2">课程名</font></th>
							<th><font size="2">授课时间</font></th>
							<th><font size="2">授课星期</font></th>
							<th><font size="2">授课班级</font></th>
							<th><font size="2">授课地点</font></th>
						</tr>
						<%
							while(rs1.next()){
								System.out.println(rs1.getString("lesson_id"));
						%>
						<tr>
							<td><font size="2"><%= rs1.getString("lesson_id") %></font></td>
							<td><font size="2"><%= rs1.getString("course_name") %></font></td>
							<td><font size="2"><%= rs1.getString("time") %></font></td>
							<td><font size="2"><%= rs1.getString("week") %></font></td>
							<td><font size="2"><%= rs1.getString("class") %></font></td>
							<td><font size="2"><%= rs1.getString("location") %></font></td>
						</tr>
						<%
								}
							} catch (Exception e) {
								out.println(e);
							}
						%>
					</table>
				</div>
			</div>
			<div id="info">
				<%
					session.setMaxInactiveInterval(360);//设置session五分钟销毁
					String strDateFormat = "yyyy-MM-dd HH:mm:ss";
					SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
					Date d = new Date(session.getCreationTime());
					String username = (String) session.getAttribute("UserName");
				%>
				<br>用户登录时间：<%=sdf.format(d)%>
				<br>用户名称：<%=username%>
				<br>session ID：<%=session.getId()%>
			</div>
		</div>
	</form>
</body>
</html>